﻿using System;
using System.Windows;
using System.Windows.Interactivity;

namespace LogoFX.Controls
{
    public class PinUnpinNotificationAction : TargetedTriggerAction<FrameworkElement>
    {
        #region Fields

        private static readonly Type s_thisType = typeof(PinUnpinNotificationAction);

        #endregion

        #region Constructors

        public PinUnpinNotificationAction()
        {
        }

        #endregion

        #region Dependency Properties

        public static readonly DependencyProperty NotificationProperty =
            DependencyProperty.Register(
                "Notification",
                typeof(Notification),
                s_thisType,
                new PropertyMetadata(null));

        #endregion

        #region Public Properties

        public Notification Notification
        {
            get { return (Notification)GetValue(NotificationProperty); }
            set { SetValue(NotificationProperty, value); }
        }

        #endregion

        #region Overrides of TriggerAction

        /// <summary>
        /// Invokes the action.
        /// </summary>
        /// <param name="parameter">The parameter to the action. If the Action does not require a parameter, the parameter may be set to a null reference.</param>
        protected override void Invoke(object parameter)
        {
            Notification.Pined = !Notification.Pined;
        }

        #endregion
    }
}
